<?php
/*
 * Created on Feb 4, 2010
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
?>
<script type="text/javascript">
	$(function() {
		$("#sortable").sortable();
		$("#sortable").disableSelection();

		$("#saveSortable").click(function(){
			$('#sortableForm').submit();
		});

		$('#sortableForm').ajaxForm({
			beforeSubmit: function(){
				// show waiting
			},
			success: function(data){
				if(data.status=="success"){
					alert(data.message);
				}
			},
			dataType: 'json'
		});
	});
</script>
<h2>Sortable</h2>
<div class="content-inner">
	<input type="image" src="<?=image_url()?>function/save.gif" id="saveSortable"/>
	<form action="<?=site_url(array("c" => "cms_site_frame", "m" => "sortby", "level" => $level, "nav_id" => $nav_id))?>" method="post" id="sortableForm">
		<ul id="sortable">
			<?php foreach($navs as $item):?>
			<li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span><input name="navIds[]" type="hidden" value="<?=$item['id']?>"/><?=$item['nav_name']?></li>
			<?php endforeach;?>
		</ul>
	</form>
</div>